﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using Komires.MataliPhysics;

namespace MySimpleScene
{

    public class Quad
    {
        Game1 demo;
        PhysicsScene scene;
        string instanceIndexName;

        public Quad(Game1 demo, int instanceIndex)
        {
            this.demo = demo;
            instanceIndexName = " " + instanceIndex.ToString();
        }

        public void Initialize(PhysicsScene scene)
        {
            this.scene = scene;
        }

        public static void CreateShapes(Game1 demo, PhysicsScene scene)
        {
        }

        public void Create(Vector3 objectPosition, Vector3 objectScale, Quaternion objectOrientation)
        {
            Shape box = scene.Factory.ShapeManager.Find("Box");

            PhysicsObject objectRoot = scene.Factory.PhysicsObjectManager.Create("Quad " + instanceIndexName);
            objectRoot.Shape = box;
            objectRoot.UserTagStr = "Box";
            objectRoot.InitLocalTransform.SetPosition(ref objectPosition);
            objectRoot.InitLocalTransform.SetScale(ref objectScale);
            objectRoot.EnableCursorInteraction = false;
            objectRoot.DrawPriority = 1;

            scene.UpdateFromInitLocalTransform(objectRoot);
        }
    }
}
